package legoproject.TestStubs;

import java.net.*;
import java.io.*;

public class ConnectionStarterTestStub {
    private ServerSocket serverSocket;
    private Socket socket;

    public void init(){
        try{
        serverSocket = new ServerSocket(12345);
        System.out.println("Slave waiting for connection on port 12345");
        socket = serverSocket.accept();
        }catch(Exception e){}
    }
    public DataInputStream getInputStream(){
        DataInputStream res = null;
        try{
        res = new DataInputStream(socket.getInputStream());
        }catch(Exception e){}
        return res;
    }
    public DataOutputStream getOutputStream(){
        DataOutputStream res = null;
        try{
        res = new DataOutputStream(socket.getOutputStream());
        }catch(Exception e){}
        return res;
    }
}
